﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using SundayWishBLL;
using SundayWishModel.Entities;
public partial class publicdish : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request["DishId"] != null)
            {
                int DishId = Convert.ToInt32(Request["DishId"]);
                ViewState["DishId"] = DishId;
                PublicDishHelper pdh = new PublicDishHelper();
                Dish dish = pdh.GetDish(DishId);
                lbCount.Text = dish.DishCount.ToString();
                lbKind.Text = dish.DishKind;
                lbName.Text = dish.DishName;
                img.ImageUrl = "~/image/" + dish.DishImage;
                lbMaterial.Text = dish.DishMaterial;
                lbintroduction.Text = dish.DishIntroduction;
                lbstep.Text = dish.DishStep;
            }
            else
            {
                Response.Redirect("privatedishlist.aspx");
            }
        }
    }
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        if (Session["user"] != null)
        {
            UserInfo user = (UserInfo)Session["user"];
            int DishId = Convert.ToInt32(ViewState["DishId"]);
            PrivateDishHelper pdh = new PrivateDishHelper();
            pdh.AddToPrivate(DishId, user.UserId);
            WebHelper.AlertMsg("aa", "添加成功");
        }
        else Response.Redirect("~/login.aspx");
    }
    protected void btnReturn_Click(object sender, EventArgs e)
    {
        Response.Redirect("publicdishlist.aspx");
    }
}
